package com.zbkj.crmeb.task.plat.poizon.enums;

import java.util.Objects;

/**
 * @author: wsl
 * @date: 2024/2/24 0024 18:19
 * @ClassName: ExpressEnum
 */
public enum OrderStatusEnum {
    TO_BE_CONFIRMED("PAID", 0, "订单待确认"),
    TO_BE_SHIPPED("CONFIRMED", 1, "普通模式：待发货|高级模式：待发货，已打包"),
    CONFIRMED("CONFIRMED", 2, "普通模式：待发货|高级模式：待发货，未打包"),
    SHIPPED("SHIPPED", 3, "买手店自发快递已发货，或买手店上门取件已揽件"),
    PICKUP_SCHEDULED("SHIPPED", 4, "上门取件模式的买手店的包裹已完成揽件预约"),
    ARRIVED_AT_FACILITY("SHIPPED", 5, "已到仓"),
    QC_FAILED_SHIPPED("SHIPPED", 6, "质检未通过"),
    QC_FAILED_FAILED("FAILED", 7, "质检未通过"),
    QC_PASSED_SHIPPED("SHIPPED", 8, "质检未通过但平台全额吃进或议价购买"),
    QC_PASSED_COMPLETED("COMPLETED", 9, "质检未通过但平台全额吃进或议价购买"),
    RETURNED("FAILED", 10, "平台已发起退货，货品将退给买手店"),
    CANCELLED_BY_PLATFORM("FAILED", 11, "订单被平台取消"),
    CANCELLED("FAILED", 12, "订单被买⼿店⾃⾏取消"),
    ;

    private String key;

    private Integer code;

    private String des;

    OrderStatusEnum(String key, Integer code, String des) {
        this.key = key;
        this.code = code;
        this.des = des;
    }

    public String getKey() {
        return key;
    }

    public Integer getCode() {
        return code;
    }

    public String getDes() {
        return des;
    }

    public static String getKeyByCode(Integer code) {
        for (OrderStatusEnum value : OrderStatusEnum.values()) {
            if (Objects.equals(value.code, code)) {
                return value.key;
            }
        }
        return null;
    }
}
